package com.example.myapplication.lawyer;

import androidx.appcompat.app.AppCompatActivity;
import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView;

import android.content.Intent;
import android.os.Bundle;
import android.util.Log;

import com.example.myapplication.R;
import com.example.myapplication.ShuJu.LegalexpertiseBean;
import com.example.myapplication.apter.LegalexpertiseApter;
import com.google.gson.Gson;

import java.util.List;

public class LegalexpertiseActivity extends AppCompatActivity {

    private List<LegalexpertiseBean.RowsBean> rows;
    private RecyclerView re_egalexpertise;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_legalexpertise);
        initview();
        //所有类目
        allcategories();


    }

    private void allcategories() {
        LegalexpertiseApter legalexpertiseApter = new LegalexpertiseApter(LegalexpertiseActivity.this, rows);
        re_egalexpertise.setAdapter(legalexpertiseApter);
        GridLayoutManager gridLayoutManager = new GridLayoutManager(LegalexpertiseActivity.this, 4);
        gridLayoutManager.setOrientation(GridLayoutManager.VERTICAL);
        re_egalexpertise.setLayoutManager(gridLayoutManager);
    }

    private void initview() {
        Intent intent = getIntent();
        String jsonStringDate = intent.getStringExtra("JSONStringDate");
        Gson gson = new Gson();
        LegalexpertiseBean rowsBean = gson.fromJson(jsonStringDate, LegalexpertiseBean.class);
        rows = rowsBean.getRows();

        re_egalexpertise = findViewById(R.id.re_egalexpertise);
    }
}